import {createRouter, createWebHistory} from 'vue-router'


const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            redirect: '/login'
        },
        {
            path: '/',
            name: 'Layout',
            component: () => import('@/views/layout/index.vue'),
            redirect: '/home',
            children: [
                {
                    path: '/home',
                    name: 'Home',
                    component: () => import('@/views/home/index.vue'),
                },
                {
                    path: '/courses',
                    name: "Courses",
                    component: () => import('@/views/courses/index.vue'),
                    redirect: '/courses/courseIntro',
                    children: [
                        {
                            path: '/courses/courseIntro',
                            name: 'CourseIntro',
                            component: () => import('@/views/courses/CourseIntro.vue')
                        },
                        {
                            path: '/courses/teacherTeam',
                            name: 'TeacherTeam',
                            component: () => import('@/views/courses/TeacherTeam.vue')
                        }
                    ]
                },
                {
                    path: '/users',
                    name: "Users",
                    component: () => import('@/views/users/index.vue'),
                    redirect: '/users/teacherPage',
                    children: [
                        {
                            path: '/users/teacherPage',
                            name: 'TeacherPage',
                            component: () => import('@/views/users/teacherPage.vue')
                        },
                        {
                            path: '/users/studentPage',
                            name: 'StudentPage',
                            component: () => import('@/views/users/studentPage.vue')
                        }
                    ]
                },
                {
                    path: '/videos',
                    name: "Videos",
                    component: () => import('@/views/videos/index.vue')
                },
                {
                    path: '/videos/videoContent/:videoId',
                    name: 'VideoContent',
                    component: () => import('@/views/videos/videoContent.vue'),
                },
                {
                    path: '/homeworks',
                    name: "Homeworks",
                    component: () => import('@/views/homeworks/index.vue')
                },
                {
                    path: '/comments',
                    name: "Comments",
                    component: () => import('@/views/comments/index.vue')
                },

            ]
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import ( '@/views/login/index.vue')
        },
        {
            path: '/register',
            component: () => import('@/views/register/index.vue')
        }
    ]
})

export default router
